package net.youball.utils.String;

import java.security.MessageDigest;

import sun.misc.BASE64Encoder;

public class MD5 {
	
	private static MessageDigest md5;
	
	static{
		try{
			md5=MessageDigest.getInstance("MD5");
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public static  String parse(String str){
		String value=null;
		try{
			BASE64Encoder base=new BASE64Encoder();
			value=base.encode(md5.digest(str.getBytes("utf-8")));
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return value;
	}
}
